﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using COM.OA.BLL;
using System.Collections.Generic;


public partial class gw_gw_documentinfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(this.Request.QueryString["docid"]))
            return;
        int did = Int32.Parse(this.Request.QueryString["docid"].ToString());

        //查看公文内容
        string sql = "doc_id='{0}'";
        sql = string.Format(sql, did);
        IList<document> dlist = documentBLL.Select(sql);
        if (dlist.Count == 1)
        {
            foreach (document d in dlist)
            {
                //将查出来的实体存到另一个实体中（修改点击数）
                document docu = new document();
                docu.doc_id = d.doc_id;
                docu.doc_dept_id = d.doc_dept_id;
                docu.doc_g_id = d.doc_g_id;
                docu.doc_u_id = d.doc_u_id;
                docu.doc_title = d.doc_title;
                docu.doc_annex = d.doc_annex;
                docu.doc_downloads = d.doc_downloads + 1;
                docu.doc_reads = d.doc_reads + 1;
                docu.doc_clicks = d.doc_clicks + 1;
                docu.doc_releasetime = d.doc_releasetime;
                docu.doc_sendu_id = d.doc_sendu_id;
                documentBLL.Update(docu);

                string path = d.doc_annex;
                this.Response.Redirect(path);
              
            }
        }
    }
}
